package br.com.saeng2D.objeto.forca_d;

import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.io.PrintWriter;

import br.com.saeng2D.objeto.AbstratoObjeto;
import br.com.saeng2D.objeto.ponto.Ponto;
import br.com.saeng2D.util.R2D;
import br.com.saeng2D.util.Util;
import br.com.saeng2D.util.Vetor;

public class Reta extends AbstratoObjeto {
	private int x1;
	private int y1;
	private int x2;
	private int y2;
	
	public Reta(int x1, int y1, int x2, int y2) {
		super(null, null, -1, -1, -1, -1);
		this.x1 = x1;
		this.y1 = y1;
		this.x2 = x2;
		this.y2 = y2;
	}

	public Reta(Ponto origem, Vetor vetor) {
		this(origem.getX(), origem.getY(), (int)(origem.getX() + vetor.x), (int)(origem.getY() + vetor.y * -1));
	}

	public Reta(int x, int y, Vetor vetor) {
		this(x, y, (int)(x + vetor.x), (int)(y + vetor.y * -1));
	}
	
	public Vetor criarVetor() {
		return Util.criarVetor(x1, y1, x2, y2);
	}
	
	public boolean ehIgual(AbstratoObjeto objeto) {
		return false;
	}

	public void alterarTamanho(int tamanho) {
	}

	public void desenhar(Graphics2D g2) {
		g2.draw(new Line2D.Float(x1, y1, x2, y2));
	}

	public void salvarXML(String prefixo, PrintWriter pw) {
	}

	public boolean estarSob(int x, int y) {
		return false;
	}

	public R2D getArea() {
		return new R2D(x, y, largura, altura);	
	}

	public AbstratoObjeto prototipo() {
		return null;
	}

	public int getX1() {
		return x1;
	}

	public void setX1(int x1) {
		this.x1 = x1;
	}

	public int getY1() {
		return y1;
	}

	public void setY1(int y1) {
		this.y1 = y1;
	}

	public int getX2() {
		return x2;
	}

	public void setX2(int x2) {
		this.x2 = x2;
	}

	public int getY2() {
		return y2;
	}

	public void setY2(int y2) {
		this.y2 = y2;
	}
}